package com.util;

import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;


import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.mail.javamail.MimeMessageHelper;

public class EmailUtil {

	
	public static void sendEmail(String toEmail) {
		JavaMailSenderImpl sender = new JavaMailSenderImpl();
		sender.setHost("smtpw.263.net");
		sender.setPort(465);
		
		sender.setUsername("msg@smartplusinc.com");
		sender.setPassword("spi654321");

		MimeMessage message = sender.createMimeMessage();
		MimeMessageHelper helper = new MimeMessageHelper(message);
		try {
			
			helper.setTo( toEmail );
			helper.setText("Thank you for ordering!");
			sender.send(message);
			
		} catch (MessagingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
}
